﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using App.Model.DTO.Article;
using App.Model.DTO.User;
using SqlSugar;
namespace App.Model
{
    public class Article : BaseId
    {
        /// <summary>
        /// 标题
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar(30)")]
        public string Title { get; set; }
        /// <summary>
        /// 封面图
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string CoverImages { get; set; }
        /// <summary>
        /// 内容
        /// </summary>
        [SugarColumn(ColumnDataType = "text")]
        public string Content { get; set; }
        /// <summary>
        /// 是否原创
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public IsOriginalEnum IsOriginal { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateAt { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>

        public DateTime UpdateAt { get; set; }
        /// <summary>
        /// 分类Id
        /// </summary>
        public string ClassificationId { get; set; }
        /// <summary>
        /// 浏览量
        /// </summary>
        public int BrowseCount { get; set; }
        /// <summary>
        /// 点赞
        /// </summary>
        public int LikeCount { get; set; }
        /// <summary>
        /// 点赞该文章的用户ID集合
        /// </summary>
        [SugarColumn(IsJson = true, IsNullable = true, ColumnDataType = "nvarchar(max)")]
        public List<string>? UserLikes { get; set; }
        /// <summary>
        /// 标签
        /// </summary>
        [SugarColumn(IsJson = true, IsNullable = true, ColumnDataType = "nvarchar(max)")]
        public ICollection<string> Tags { get; set; }
        /// <summary>
        /// 作者Id
        /// </summary>
        public string UserId { get; set; }
        /// <summary>
        /// 文章状态
        /// </summary>
        public ArticleStatusEnum Status { get; set; }
        [SugarColumn(IsNullable = true)]
        public bool IsDelete { get; set; }
        [SugarColumn(IsNullable = true)]
        public bool IsTop { get; set; }
        /// <summary>
        /// 分类不映射到数据库
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(ClassificationId))]
        public Classification Classification { get; set; }

        [Navigate(NavigateType.OneToOne, nameof(UserId))]
        public UserInfo UserInfo { get; set; }

    }
}
